import 'package:ladder_cash/app/com/service/burial_point_service.dart';
import 'package:ladder_cash/app/page/component/common.dart';
import 'package:ladder_cash/app/page/component/decoration_bg.dart';
import 'package:ladder_cash/generated/l10n.dart';
import 'package:ladder_cash/value/app_lstyle.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:get/get.dart';
import 'package:liuxlcommon/view/lxl_widget.dart';
import 'package:liuxlcommon/view/my_style.dart';
import 'package:liuxlcommon/view/loading_view.dart';
import '../../../Global.dart';
import '../../../gen/assets.gen.dart';
import '../../../library/src/logger.dart';
import '../../comm_key_def.dart';
import 'authentication_logic.dart';

class PersonaInformationPage extends StatefulWidget {
  PersonaInformationPage({super.key});

  @override
  _AuthenticationPageState createState() => _AuthenticationPageState();
}

class _AuthenticationPageState extends State<PersonaInformationPage> {
  final logic = Get.find<AuthenticationLogic>();

  @override
  void initState() {
    super.initState();
    BurialPointService.start(BPoint.personage);
  }

  @override
  Widget build(BuildContext context) {
    return LoadingView(
      isPullDown: true,
      future: () => logic.getUserInfo(),
      datas: logic.authenticationInfo,
      onSuccess: () {
        if (logic.authenticationInfo != null) logic.update();
      },
      body: () => Column(children: [
        getTitleTop(),
        Expanded(
          child: Container(
              padding: EdgeInsets.symmetric(vertical:  20.w),
              width: Global.width,
              decoration: BoxDecoration(
                color: Colors.white,
                borderRadius:  getTopRadius(radius: 8.0)
              ),
              child: LFlexV([logic.chooseList(type: CommKeyDef.personal),confirmBtn]))

        ),
      ],)
    );
  }

  get confirmBtn => Column(
      children: [
        LSizeBoxHeight(16.w),
        Container(
          padding: EdgeInsets.symmetric(horizontal: 16.w),
          height: 46.w,
          child: commonBtn(S.current.next, callback: (){logic.saveUserInfo();}),
        ),
        LSizeBoxHeight(30.w)
      ]);
}
